{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import h2o\n",
    "from h2o.estimators.gbm import H2OGradientBoostingEstimator\n",
    "from h2o.estimators.deeplearning import H2ODeepLearningEstimator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td>H2O cluster uptime: </td>\n",
       "<td>1 hours 13 minutes 22 seconds 521 milliseconds </td></tr>\n",
       "<tr><td>H2O cluster version: </td>\n",
       "<td>3.7.0.99999</td></tr>\n",
       "<tr><td>H2O cluster name: </td>\n",
       "<td>ludirehak</td></tr>\n",
       "<tr><td>H2O cluster total nodes: </td>\n",
       "<td>1</td></tr>\n",
       "<tr><td>H2O cluster total free memory: </td>\n",
       "<td>3.24 GB</td></tr>\n",
       "<tr><td>H2O cluster total cores: </td>\n",
       "<td>8</td></tr>\n",
       "<tr><td>H2O cluster allowed cores: </td>\n",
       "<td>8</td></tr>\n",
       "<tr><td>H2O cluster healthy: </td>\n",
       "<td>True</td></tr>\n",
       "<tr><td>H2O Connection ip: </td>\n",
       "<td>127.0.0.1</td></tr>\n",
       "<tr><td>H2O Connection port: </td>\n",
       "<td>54321</td></tr>\n",
       "<tr><td>H2O Connection proxy: </td>\n",
       "<td>None</td></tr>\n",
       "<tr><td>Python Version: </td>\n",
       "<td>3.5.1</td></tr></table></div>"
      ],
      "text/plain": [
       "------------------------------  ----------------------------------------------\n",
       "H2O cluster uptime:             1 hours 13 minutes 22 seconds 521 milliseconds\n",
       "H2O cluster version:            3.7.0.99999\n",
       "H2O cluster name:               ludirehak\n",
       "H2O cluster total nodes:        1\n",
       "H2O cluster total free memory:  3.24 GB\n",
       "H2O cluster total cores:        8\n",
       "H2O cluster allowed cores:      8\n",
       "H2O cluster healthy:            True\n",
       "H2O Connection ip:              127.0.0.1\n",
       "H2O Connection port:            54321\n",
       "H2O Connection proxy:\n",
       "Python Version:                 3.5.1\n",
       "------------------------------  ----------------------------------------------"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Connect to a cluster\n",
    "h2o.init()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Import and Parse weather data\n",
      "\n",
      "Parse Progress: [##################################################] 100%\n",
      "Rows:5,162 Cols:7\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>19</td>\n",
       "<td>8.225108</td>\n",
       "<td>    1.5 KB</td>\n",
       "<td>3.3811588</td></tr>\n",
       "<tr><td>C0D</td>\n",
       "<td>Constant Reals</td>\n",
       "<td>33</td>\n",
       "<td>14.285715</td>\n",
       "<td>    2.6 KB</td>\n",
       "<td>5.872539</td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>8</td>\n",
       "<td>3.4632034</td>\n",
       "<td>    1.7 KB</td>\n",
       "<td>3.9528418</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>135</td>\n",
       "<td>58.441555</td>\n",
       "<td>   29.6 KB</td>\n",
       "<td>67.35625</td></tr>\n",
       "<tr><td>C1S</td>\n",
       "<td>1-Byte Fractions</td>\n",
       "<td>36</td>\n",
       "<td>15.584415</td>\n",
       "<td>    8.5 KB</td>\n",
       "<td>19.437214</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size     size_percentage\n",
       "------------  -------------------------  -------  ------------------  -------  -----------------\n",
       "C0L           Constant Integers          19       8.22511             1.5 KB   3.38116\n",
       "C0D           Constant Reals             33       14.2857             2.6 KB   5.87254\n",
       "C1            1-Byte Integers            8        3.4632              1.7 KB   3.95284\n",
       "C1N           1-Byte Integers (w/o NAs)  135      58.4416             29.6 KB  67.3563\n",
       "C1S           1-Byte Fractions           36       15.5844             8.5 KB   19.4372"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>   43.9 KB</td>\n",
       "<td>5162.0</td>\n",
       "<td>33.0</td>\n",
       "<td>231.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>   43.9 KB</td>\n",
       "<td>5162.0</td>\n",
       "<td>33.0</td>\n",
       "<td>231.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>   43.9 KB</td>\n",
       "<td>5162.0</td>\n",
       "<td>33.0</td>\n",
       "<td>231.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>   43.9 KB</td>\n",
       "<td>5162.0</td>\n",
       "<td>33.0</td>\n",
       "<td>231.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>   43.9 KB</td>\n",
       "<td>5162.0</td>\n",
       "<td>33.0</td>\n",
       "<td>231.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size     number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  -------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  43.9 KB  5162              33                             231\n",
       "mean               43.9 KB  5162              33                             231\n",
       "min                43.9 KB  5162              33                             231\n",
       "max                43.9 KB  5162              33                             231\n",
       "stddev             0  B     0                 0                              0\n",
       "total              43.9 KB  5162              33                             231"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>date  </th><th>month            </th><th>day               </th><th>year              </th><th>maxTemp           </th><th>meanTemp          </th><th>minTemp           </th></tr>\n",
       "<tr><td>type   </td><td>time  </td><td>int              </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td></tr>\n",
       "<tr><td>mins   </td><td>NaN   </td><td>1.0              </td><td>1.0               </td><td>2001.0            </td><td>-2.0              </td><td>-9.0              </td><td>-18.0             </td></tr>\n",
       "<tr><td>mean   </td><td>0.0   </td><td>6.47442851607904 </td><td>15.708252615265401</td><td>2007.5714839209609</td><td>58.871042920955524</td><td>50.31035152456788 </td><td>41.4812584967955  </td></tr>\n",
       "<tr><td>maxs   </td><td>NaN   </td><td>12.0             </td><td>31.0              </td><td>2015.0            </td><td>103.0             </td><td>93.0              </td><td>82.0              </td></tr>\n",
       "<tr><td>sigma  </td><td>-0.0  </td><td>3.469051716937685</td><td>8.798951739966594 </td><td>4.077340905700527 </td><td>21.482977723685387</td><td>19.930239926608884</td><td>19.020729712312264</td></tr>\n",
       "<tr><td>zeros  </td><td>-5162 </td><td>0                </td><td>0                 </td><td>0                 </td><td>0                 </td><td>2                 </td><td>16                </td></tr>\n",
       "<tr><td>missing</td><td>5162  </td><td>0                </td><td>0                 </td><td>0                 </td><td>13                </td><td>13                </td><td>13                </td></tr>\n",
       "<tr><td>0      </td><td>nan   </td><td>1.0              </td><td>1.0               </td><td>2001.0            </td><td>23.0              </td><td>14.0              </td><td>6.0               </td></tr>\n",
       "<tr><td>1      </td><td>nan   </td><td>1.0              </td><td>2.0               </td><td>2001.0            </td><td>18.0              </td><td>12.0              </td><td>6.0               </td></tr>\n",
       "<tr><td>2      </td><td>nan   </td><td>1.0              </td><td>3.0               </td><td>2001.0            </td><td>28.0              </td><td>18.0              </td><td>8.0               </td></tr>\n",
       "<tr><td>3      </td><td>nan   </td><td>1.0              </td><td>4.0               </td><td>2001.0            </td><td>30.0              </td><td>24.0              </td><td>19.0              </td></tr>\n",
       "<tr><td>4      </td><td>nan   </td><td>1.0              </td><td>5.0               </td><td>2001.0            </td><td>36.0              </td><td>30.0              </td><td>21.0              </td></tr>\n",
       "<tr><td>5      </td><td>nan   </td><td>1.0              </td><td>6.0               </td><td>2001.0            </td><td>33.0              </td><td>26.0              </td><td>19.0              </td></tr>\n",
       "<tr><td>6      </td><td>nan   </td><td>1.0              </td><td>7.0               </td><td>2001.0            </td><td>34.0              </td><td>28.0              </td><td>21.0              </td></tr>\n",
       "<tr><td>7      </td><td>nan   </td><td>1.0              </td><td>8.0               </td><td>2001.0            </td><td>26.0              </td><td>20.0              </td><td>14.0              </td></tr>\n",
       "<tr><td>8      </td><td>nan   </td><td>1.0              </td><td>9.0               </td><td>2001.0            </td><td>23.0              </td><td>16.0              </td><td>10.0              </td></tr>\n",
       "<tr><td>9      </td><td>nan   </td><td>1.0              </td><td>10.0              </td><td>2001.0            </td><td>34.0              </td><td>26.0              </td><td>19.0              </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Import and Parse census data\n",
      "\n",
      "Parse Progress: [##################################################] 100%\n",
      "Rows:79 Cols:9\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>3</td>\n",
       "<td>33.333336</td>\n",
       "<td>    441  B</td>\n",
       "<td>22.546013</td></tr>\n",
       "<tr><td>C1S</td>\n",
       "<td>1-Byte Fractions</td>\n",
       "<td>1</td>\n",
       "<td>11.111112</td>\n",
       "<td>    163  B</td>\n",
       "<td>8.333334</td></tr>\n",
       "<tr><td>C2S</td>\n",
       "<td>2-Byte Fractions</td>\n",
       "<td>4</td>\n",
       "<td>44.444447</td>\n",
       "<td>    968  B</td>\n",
       "<td>49.488754</td></tr>\n",
       "<tr><td>C4</td>\n",
       "<td>4-Byte Integers</td>\n",
       "<td>1</td>\n",
       "<td>11.111112</td>\n",
       "<td>    384  B</td>\n",
       "<td>19.6319</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name        count    count_percentage    size    size_percentage\n",
       "------------  ----------------  -------  ------------------  ------  -----------------\n",
       "C1            1-Byte Integers   3        33.3333             441  B  22.546\n",
       "C1S           1-Byte Fractions  1        11.1111             163  B  8.33333\n",
       "C2S           2-Byte Fractions  4        44.4444             968  B  49.4888\n",
       "C4            4-Byte Integers   1        11.1111             384  B  19.6319"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>    1.9 KB</td>\n",
       "<td>79.0</td>\n",
       "<td>1.0</td>\n",
       "<td>9.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>    1.9 KB</td>\n",
       "<td>79.0</td>\n",
       "<td>1.0</td>\n",
       "<td>9.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>    1.9 KB</td>\n",
       "<td>79.0</td>\n",
       "<td>1.0</td>\n",
       "<td>9.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>    1.9 KB</td>\n",
       "<td>79.0</td>\n",
       "<td>1.0</td>\n",
       "<td>9.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>    1.9 KB</td>\n",
       "<td>79.0</td>\n",
       "<td>1.0</td>\n",
       "<td>9.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size    number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  ------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  1.9 KB  79                1                              9\n",
       "mean               1.9 KB  79                1                              9\n",
       "min                1.9 KB  79                1                              9\n",
       "max                1.9 KB  79                1                              9\n",
       "stddev             0  B    0                 0                              0\n",
       "total              1.9 KB  79                1                              9"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>Community Area Number  </th><th>COMMUNITY AREA NAME  </th><th>PERCENT OF HOUSING CROWDED  </th><th>PERCENT HOUSEHOLDS BELOW POVERTY  </th><th>PERCENT AGED 16  UNEMPLOYED  </th><th>PERCENT AGED 25  WITHOUT HIGH SCHOOL DIPLOMA  </th><th>PERCENT AGED UNDER 18 OR OVER 64  </th><th>PER CAPITA INCOME   </th><th>HARDSHIP INDEX    </th></tr>\n",
       "<tr><td>type   </td><td>int                    </td><td>enum                 </td><td>real                        </td><td>real                              </td><td>real                         </td><td>real                                          </td><td>real                              </td><td>int                 </td><td>int               </td></tr>\n",
       "<tr><td>mins   </td><td>1.0                    </td><td>0.0                  </td><td>0.30000000000000004         </td><td>3.3000000000000003                </td><td>4.7                          </td><td>2.5                                           </td><td>13.5                              </td><td>8201.0              </td><td>1.0               </td></tr>\n",
       "<tr><td>mean   </td><td>39.0                   </td><td>NaN                  </td><td>4.920512820512822           </td><td>21.73974358974359                 </td><td>15.341025641025642           </td><td>20.33076923076924                             </td><td>35.71794871794871                 </td><td>25597.000000000004  </td><td>49.506493506493506</td></tr>\n",
       "<tr><td>maxs   </td><td>77.0                   </td><td>78.0                 </td><td>15.8                        </td><td>56.5                              </td><td>35.9                         </td><td>54.800000000000004                            </td><td>51.5                              </td><td>88669.0             </td><td>98.0              </td></tr>\n",
       "<tr><td>sigma  </td><td>22.371857321197094     </td><td>NaN                  </td><td>3.6589814413502006          </td><td>11.457230912971083                </td><td>7.49949670860991             </td><td>11.746514351100048                            </td><td>7.284421084944952                 </td><td>15196.405541331917  </td><td>28.69055565156158 </td></tr>\n",
       "<tr><td>zeros  </td><td>0                      </td><td>1                    </td><td>0                           </td><td>0                                 </td><td>0                            </td><td>0                                             </td><td>0                                 </td><td>0                   </td><td>0                 </td></tr>\n",
       "<tr><td>missing</td><td>2                      </td><td>0                    </td><td>1                           </td><td>1                                 </td><td>1                            </td><td>1                                             </td><td>1                                 </td><td>1                   </td><td>2                 </td></tr>\n",
       "<tr><td>0      </td><td>nan                    </td><td>COMMUNITY AREA NAME  </td><td>nan                         </td><td>nan                               </td><td>nan                          </td><td>nan                                           </td><td>nan                               </td><td>nan                 </td><td>nan               </td></tr>\n",
       "<tr><td>1      </td><td>1.0                    </td><td>Rogers Park          </td><td>7.7                         </td><td>23.6                              </td><td>8.700000000000001            </td><td>18.2                                          </td><td>27.5                              </td><td>23939.0             </td><td>39.0              </td></tr>\n",
       "<tr><td>2      </td><td>2.0                    </td><td>West Ridge           </td><td>7.800000000000001           </td><td>17.2                              </td><td>8.8                          </td><td>20.8                                          </td><td>38.5                              </td><td>23040.0             </td><td>46.0              </td></tr>\n",
       "<tr><td>3      </td><td>3.0                    </td><td>Uptown               </td><td>3.8000000000000003          </td><td>24.0                              </td><td>8.9                          </td><td>11.8                                          </td><td>22.200000000000003                </td><td>35787.0             </td><td>20.0              </td></tr>\n",
       "<tr><td>4      </td><td>4.0                    </td><td>Lincoln Square       </td><td>3.4000000000000004          </td><td>10.9                              </td><td>8.200000000000001            </td><td>13.4                                          </td><td>25.5                              </td><td>37524.0             </td><td>17.0              </td></tr>\n",
       "<tr><td>5      </td><td>5.0                    </td><td>North Center         </td><td>0.30000000000000004         </td><td>7.5                               </td><td>5.2                          </td><td>4.5                                           </td><td>26.200000000000003                </td><td>57123.0             </td><td>6.0               </td></tr>\n",
       "<tr><td>6      </td><td>6.0                    </td><td>Lake View            </td><td>1.1                         </td><td>11.4                              </td><td>4.7                          </td><td>2.6                                           </td><td>17.0                              </td><td>60058.0             </td><td>5.0               </td></tr>\n",
       "<tr><td>7      </td><td>7.0                    </td><td>Lincoln Park         </td><td>0.8                         </td><td>12.3                              </td><td>5.1000000000000005           </td><td>3.6                                           </td><td>21.5                              </td><td>71551.0             </td><td>2.0               </td></tr>\n",
       "<tr><td>8      </td><td>8.0                    </td><td>Near North Side      </td><td>1.9000000000000001          </td><td>12.9                              </td><td>7.0                          </td><td>2.5                                           </td><td>22.6                              </td><td>88669.0             </td><td>1.0               </td></tr>\n",
       "<tr><td>9      </td><td>9.0                    </td><td>Edison Park          </td><td>1.1                         </td><td>3.3000000000000003                </td><td>6.5                          </td><td>7.4                                           </td><td>35.300000000000004                </td><td>40959.0             </td><td>8.0               </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Import and Parse crimes data\n",
      "\n",
      "Parse Progress: [##################################################] 100%\n",
      "Rows:9,999 Cols:22\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>1</td>\n",
       "<td>4.5454545</td>\n",
       "<td>     80  B</td>\n",
       "<td>0.0092869</td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>8</td>\n",
       "<td>36.363636</td>\n",
       "<td>   78.6 KB</td>\n",
       "<td>9.349084</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>2</td>\n",
       "<td>9.090909</td>\n",
       "<td>   19.7 KB</td>\n",
       "<td>2.337271</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>4</td>\n",
       "<td>18.181818</td>\n",
       "<td>   78.4 KB</td>\n",
       "<td>9.317509</td></tr>\n",
       "<tr><td>C4</td>\n",
       "<td>4-Byte Integers</td>\n",
       "<td>3</td>\n",
       "<td>13.636364</td>\n",
       "<td>  117.4 KB</td>\n",
       "<td>13.952581</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>2</td>\n",
       "<td>9.090909</td>\n",
       "<td>  390.7 KB</td>\n",
       "<td>46.446617</td></tr>\n",
       "<tr><td>C8D</td>\n",
       "<td>64-bit Reals</td>\n",
       "<td>2</td>\n",
       "<td>9.090909</td>\n",
       "<td>  156.4 KB</td>\n",
       "<td>18.587654</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size      size_percentage\n",
       "------------  -------------------------  -------  ------------------  --------  -----------------\n",
       "C0L           Constant Integers          1        4.54545             80  B     0.00928686\n",
       "C1            1-Byte Integers            8        36.3636             78.6 KB   9.34908\n",
       "C1N           1-Byte Integers (w/o NAs)  2        9.09091             19.7 KB   2.33727\n",
       "C2            2-Byte Integers            4        18.1818             78.4 KB   9.31751\n",
       "C4            4-Byte Integers            3        13.6364             117.4 KB  13.9526\n",
       "CStr          String                     2        9.09091             390.7 KB  46.4466\n",
       "C8D           64-bit Reals               2        9.09091             156.4 KB  18.5877"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>  841.2 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>22.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>  841.2 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>22.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>  841.2 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>22.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>  841.2 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>22.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>  841.2 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>22.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size      number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  --------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  841.2 KB  9999              1                              22\n",
       "mean               841.2 KB  9999              1                              22\n",
       "min                841.2 KB  9999              1                              22\n",
       "max                841.2 KB  9999              1                              22\n",
       "stddev             0  B      0                 0                              0\n",
       "total              841.2 KB  9999              1                              22"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>ID               </th><th>Case Number  </th><th>Date                  </th><th>Block               </th><th>IUCR             </th><th>Primary Type   </th><th>Description                 </th><th>Location Description  </th><th>Arrest             </th><th>Domestic           </th><th>Beat              </th><th>District          </th><th>Ward              </th><th>Community Area    </th><th>FBI Code          </th><th>X Coordinate      </th><th>Y Coordinate      </th><th>Year  </th><th>Updated On            </th><th>Latitude           </th><th>Longitude          </th><th>Location                     </th></tr>\n",
       "<tr><td>type   </td><td>int              </td><td>string       </td><td>string                </td><td>enum                </td><td>int              </td><td>enum           </td><td>enum                        </td><td>enum                  </td><td>enum               </td><td>enum               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int   </td><td>enum                  </td><td>real               </td><td>real               </td><td>enum                         </td></tr>\n",
       "<tr><td>mins   </td><td>21735.0          </td><td>NaN          </td><td>NaN                   </td><td>0.0                 </td><td>110.0            </td><td>0.0            </td><td>0.0                         </td><td>0.0                   </td><td>0.0                </td><td>0.0                </td><td>111.0             </td><td>1.0               </td><td>1.0               </td><td>1.0               </td><td>2.0               </td><td>1100317.0         </td><td>1814255.0         </td><td>2015.0</td><td>0.0                   </td><td>41.64507243        </td><td>-87.906463888      </td><td>0.0                          </td></tr>\n",
       "<tr><td>mean   </td><td>9931318.737373699</td><td>NaN          </td><td>NaN                   </td><td>NaN                 </td><td>1189.676513569939</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.29282928292829274</td><td>0.15231523152315235</td><td>1159.6180618061765</td><td>11.348988512757918</td><td>22.954095409541008</td><td>37.447644764476536</td><td>12.740123622682114</td><td>1163880.5981498407</td><td>1885916.1498424308</td><td>2015.0</td><td>NaN                   </td><td>41.842565224673535 </td><td>-87.67414052209607 </td><td>NaN                          </td></tr>\n",
       "<tr><td>maxs   </td><td>9962898.0        </td><td>NaN          </td><td>NaN                   </td><td>6517.0              </td><td>5131.0           </td><td>26.0           </td><td>198.0                       </td><td>90.0                  </td><td>1.0                </td><td>1.0                </td><td>2535.0            </td><td>25.0              </td><td>50.0              </td><td>77.0              </td><td>26.0              </td><td>1205069.0         </td><td>1951533.0         </td><td>2015.0</td><td>32.0                  </td><td>42.022646183       </td><td>-87.524773286      </td><td>8603.0                       </td></tr>\n",
       "<tr><td>sigma  </td><td>396787.5642214295</td><td>NaN          </td><td>NaN                   </td><td>NaN                 </td><td>927.7514355826443</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.4550835155878833 </td><td>0.3593441468595258 </td><td>695.7602987498396 </td><td>6.945474933012859 </td><td>13.649566114361296</td><td>21.274876222320856</td><td>7.574238579108433 </td><td>16496.449368147238</td><td>31274.01631985589 </td><td>0.0   </td><td>NaN                   </td><td>0.08601865793584824</td><td>0.06003579706529789</td><td>NaN                          </td></tr>\n",
       "<tr><td>zeros  </td><td>0                </td><td>0            </td><td>0                     </td><td>3                   </td><td>0                </td><td>11             </td><td>933                         </td><td>19                    </td><td>7071               </td><td>8476               </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0     </td><td>603                   </td><td>0                  </td><td>0                  </td><td>1                            </td></tr>\n",
       "<tr><td>missing</td><td>0                </td><td>0            </td><td>0                     </td><td>0                   </td><td>419              </td><td>0              </td><td>0                           </td><td>6                     </td><td>0                  </td><td>0                  </td><td>0                 </td><td>162               </td><td>0                 </td><td>0                 </td><td>2557              </td><td>162               </td><td>162               </td><td>0     </td><td>0                     </td><td>162                </td><td>162                </td><td>162                          </td></tr>\n",
       "<tr><td>0      </td><td>9955810.0        </td><td>HY144797     </td><td>02/08/2015 11:43:40 PM</td><td>081XX S COLES AVE   </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>422.0             </td><td>4.0               </td><td>7.0               </td><td>46.0              </td><td>18.0              </td><td>1198273.0         </td><td>1851626.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.747693646       </td><td>-87.54903538900001 </td><td>(41.747693646, -87.549035389)</td></tr>\n",
       "<tr><td>1      </td><td>9955861.0        </td><td>HY144838     </td><td>02/08/2015 11:41:42 PM</td><td>118XX S STATE ST    </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>true               </td><td>true               </td><td>522.0             </td><td>5.0               </td><td>34.0              </td><td>53.0              </td><td>nan               </td><td>1178335.0         </td><td>1826581.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.679442289       </td><td>-87.622850758      </td><td>(41.679442289, -87.622850758)</td></tr>\n",
       "<tr><td>2      </td><td>9955801.0        </td><td>HY144779     </td><td>02/08/2015 11:30:22 PM</td><td>002XX S LARAMIE AVE </td><td>2026.0           </td><td>NARCOTICS      </td><td>POSS: PCP                   </td><td>SIDEWALK              </td><td>true               </td><td>false              </td><td>1522.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>18.0              </td><td>1141717.0         </td><td>1898581.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.877773330000004 </td><td>-87.755117993      </td><td>(41.87777333, -87.755117993) </td></tr>\n",
       "<tr><td>3      </td><td>9956197.0        </td><td>HY144787     </td><td>02/08/2015 11:30:23 PM</td><td>006XX E 67TH ST     </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>321.0             </td><td>nan               </td><td>6.0               </td><td>42.0              </td><td>18.0              </td><td>nan               </td><td>nan               </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>nan                </td><td>nan                </td><td>                             </td></tr>\n",
       "<tr><td>4      </td><td>9955846.0        </td><td>HY144829     </td><td>02/08/2015 11:30:58 PM</td><td>0000X S MAYFIELD AVE</td><td>610.0            </td><td>BURGLARY       </td><td>FORCIBLE ENTRY              </td><td>APARTMENT             </td><td>false              </td><td>false              </td><td>1513.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>5.0               </td><td>1137239.0         </td><td>1899372.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.880025548000006 </td><td>-87.77154132400001 </td><td>(41.880025548, -87.771541324)</td></tr>\n",
       "<tr><td>5      </td><td>9955835.0        </td><td>HY144778     </td><td>02/08/2015 11:30:21 PM</td><td>010XX W 48TH ST     </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>false              </td><td>true               </td><td>933.0             </td><td>9.0               </td><td>3.0               </td><td>61.0              </td><td>nan               </td><td>1169986.0         </td><td>1873019.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.807059405000004 </td><td>-87.65206589       </td><td>(41.807059405, -87.65206589) </td></tr>\n",
       "<tr><td>6      </td><td>9955872.0        </td><td>HY144822     </td><td>02/08/2015 11:27:24 PM</td><td>015XX W ARTHUR AVE  </td><td>1320.0           </td><td>CRIMINAL DAMAGE</td><td>TO VEHICLE                  </td><td>STREET                </td><td>false              </td><td>false              </td><td>2432.0            </td><td>24.0              </td><td>40.0              </td><td>1.0               </td><td>14.0              </td><td>1164732.0         </td><td>1943222.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.999814056000005 </td><td>-87.669342967      </td><td>(41.999814056, -87.669342967)</td></tr>\n",
       "<tr><td>7      </td><td>21752.0          </td><td>HY144738     </td><td>02/08/2015 11:26:12 PM</td><td>060XX W GRAND AVE   </td><td>110.0            </td><td>HOMICIDE       </td><td>FIRST DEGREE MURDER         </td><td>STREET                </td><td>true               </td><td>false              </td><td>2512.0            </td><td>25.0              </td><td>37.0              </td><td>19.0              </td><td>nan               </td><td>1135910.0         </td><td>1914206.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.920755683       </td><td>-87.776067514      </td><td>(41.920755683, -87.776067514)</td></tr>\n",
       "<tr><td>8      </td><td>9955808.0        </td><td>HY144775     </td><td>02/08/2015 11:20:33 PM</td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>OTHER                 </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td></tr>\n",
       "<tr><td>9      </td><td>9958275.0        </td><td>HY146732     </td><td>02/08/2015 11:15:36 PM</td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>HOTEL/MOTEL           </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>2015.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from h2o.utils.shared_utils import _locate # private function. used to find files within h2o git project directory.\n",
    "weather_path = _locate(\"smalldata/chicago/chicagoAllWeather.csv\")\n",
    "census_path = _locate(\"smalldata/chicago/chicagoCensus.csv\")\n",
    "crimes_path = _locate(\"smalldata/chicago/chicagoCrimes10k.csv.zip\")\n",
    "\n",
    "print(\"Import and Parse weather data\")\n",
    "weather = h2o.import_file(path=weather_path, col_types = [\"time\"] + [\"numeric\"]*6)\n",
    "weather.drop(\"date\")\n",
    "weather.describe()\n",
    "\n",
    "print(\"Import and Parse census data\")\n",
    "census = h2o.import_file(path=census_path, col_types = [\"numeric\", \"enum\"] + [\"numeric\"]*7)\n",
    "census.describe()\n",
    "\n",
    "print(\"Import and Parse crimes data\")\n",
    "crimes = h2o.import_file(path=crimes_path)\n",
    "crimes.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows:9,999 Cols:27\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>1</td>\n",
       "<td>3.7037036</td>\n",
       "<td>     80  B</td>\n",
       "<td>0.0110837</td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>8</td>\n",
       "<td>29.62963</td>\n",
       "<td>   78.6 KB</td>\n",
       "<td>11.157955</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>7</td>\n",
       "<td>25.925926</td>\n",
       "<td>   68.8 KB</td>\n",
       "<td>9.763211</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>4</td>\n",
       "<td>14.814815</td>\n",
       "<td>   78.4 KB</td>\n",
       "<td>11.12027</td></tr>\n",
       "<tr><td>C4</td>\n",
       "<td>4-Byte Integers</td>\n",
       "<td>3</td>\n",
       "<td>11.111112</td>\n",
       "<td>  117.4 KB</td>\n",
       "<td>16.652143</td></tr>\n",
       "<tr><td>C8</td>\n",
       "<td>64-bit Integers</td>\n",
       "<td>1</td>\n",
       "<td>3.7037036</td>\n",
       "<td>   78.2 KB</td>\n",
       "<td>11.092008</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>1</td>\n",
       "<td>3.7037036</td>\n",
       "<td>  127.0 KB</td>\n",
       "<td>18.019316</td></tr>\n",
       "<tr><td>C8D</td>\n",
       "<td>64-bit Reals</td>\n",
       "<td>2</td>\n",
       "<td>7.4074073</td>\n",
       "<td>  156.4 KB</td>\n",
       "<td>22.184013</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size      size_percentage\n",
       "------------  -------------------------  -------  ------------------  --------  -----------------\n",
       "C0L           Constant Integers          1        3.7037              80  B     0.0110837\n",
       "C1            1-Byte Integers            8        29.6296             78.6 KB   11.158\n",
       "C1N           1-Byte Integers (w/o NAs)  7        25.9259             68.8 KB   9.76321\n",
       "C2            2-Byte Integers            4        14.8148             78.4 KB   11.1203\n",
       "C4            4-Byte Integers            3        11.1111             117.4 KB  16.6521\n",
       "C8            64-bit Integers            1        3.7037              78.2 KB   11.092\n",
       "CStr          String                     1        3.7037              127.0 KB  18.0193\n",
       "C8D           64-bit Reals               2        7.40741             156.4 KB  22.184"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>  704.9 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>27.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>  704.9 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>27.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>  704.9 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>27.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>  704.9 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>27.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>  704.9 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>27.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size      number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  --------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  704.9 KB  9999              1                              27\n",
       "mean               704.9 KB  9999              1                              27\n",
       "min                704.9 KB  9999              1                              27\n",
       "max                704.9 KB  9999              1                              27\n",
       "stddev             0  B      0                 0                              0\n",
       "total              704.9 KB  9999              1                              27"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>ID               </th><th>Case Number  </th><th>Date              </th><th>Block               </th><th>IUCR             </th><th>Primary Type   </th><th>Description                 </th><th>Location Description  </th><th>Arrest             </th><th>Domestic           </th><th>Beat              </th><th>District          </th><th>Ward              </th><th>Community Area    </th><th>FBI Code          </th><th>X Coordinate      </th><th>Y Coordinate      </th><th>Year  </th><th>Updated On            </th><th>Latitude           </th><th>Longitude          </th><th>Location                     </th><th>Day               </th><th>Month             </th><th>WeekNum           </th><th>WeekDay  </th><th>HourOfDay         </th></tr>\n",
       "<tr><td>type   </td><td>int              </td><td>string       </td><td>int               </td><td>enum                </td><td>int              </td><td>enum           </td><td>enum                        </td><td>enum                  </td><td>enum               </td><td>enum               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int   </td><td>enum                  </td><td>real               </td><td>real               </td><td>enum                         </td><td>int               </td><td>int               </td><td>int               </td><td>enum     </td><td>int               </td></tr>\n",
       "<tr><td>mins   </td><td>21735.0          </td><td>NaN          </td><td>1422030630000.0   </td><td>0.0                 </td><td>110.0            </td><td>0.0            </td><td>0.0                         </td><td>0.0                   </td><td>0.0                </td><td>0.0                </td><td>111.0             </td><td>1.0               </td><td>1.0               </td><td>1.0               </td><td>2.0               </td><td>1100317.0         </td><td>1814255.0         </td><td>3915.0</td><td>0.0                   </td><td>41.64507243        </td><td>-87.906463888      </td><td>0.0                          </td><td>1.0               </td><td>2.0               </td><td>4.0               </td><td>0.0      </td><td>0.0               </td></tr>\n",
       "<tr><td>mean   </td><td>9931318.737373699</td><td>NaN          </td><td>1422714450809.2847</td><td>NaN                 </td><td>1189.676513569939</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.29282928292829274</td><td>0.15231523152315235</td><td>1159.6180618061765</td><td>11.348988512757918</td><td>22.954095409541008</td><td>37.447644764476536</td><td>12.740123622682114</td><td>1163880.5981498407</td><td>1885916.1498424308</td><td>3915.0</td><td>NaN                   </td><td>41.842565224673535 </td><td>-87.67414052209607 </td><td>NaN                          </td><td>17.683968396839663</td><td>2.419441944194423 </td><td>5.1808180818082   </td><td>NaN      </td><td>13.631963196319662</td></tr>\n",
       "<tr><td>maxs   </td><td>9962898.0        </td><td>NaN          </td><td>1423467820000.0   </td><td>6517.0              </td><td>5131.0           </td><td>26.0           </td><td>198.0                       </td><td>90.0                  </td><td>1.0                </td><td>1.0                </td><td>2535.0            </td><td>25.0              </td><td>50.0              </td><td>77.0              </td><td>26.0              </td><td>1205069.0         </td><td>1951533.0         </td><td>3915.0</td><td>32.0                  </td><td>42.022646183       </td><td>-87.524773286      </td><td>8603.0                       </td><td>31.0              </td><td>3.0               </td><td>6.0               </td><td>6.0      </td><td>23.0              </td></tr>\n",
       "<tr><td>sigma  </td><td>396787.5642214295</td><td>NaN          </td><td>433879245.1905283 </td><td>NaN                 </td><td>927.7514355826443</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.4550835155878833 </td><td>0.3593441468595258 </td><td>695.7602987498396 </td><td>6.945474933012859 </td><td>13.649566114361296</td><td>21.274876222320856</td><td>7.574238579108433 </td><td>16496.449368147238</td><td>31274.01631985589 </td><td>0.0   </td><td>NaN                   </td><td>0.08601865793584824</td><td>0.06003579706529789</td><td>NaN                          </td><td>11.180104335827702</td><td>0.4934924067865386</td><td>0.7389298304087689</td><td>NaN      </td><td>6.4732173580715475</td></tr>\n",
       "<tr><td>zeros  </td><td>0                </td><td>0            </td><td>0                 </td><td>3                   </td><td>0                </td><td>11             </td><td>933                         </td><td>19                    </td><td>7071               </td><td>8476               </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0     </td><td>603                   </td><td>0                  </td><td>0                  </td><td>1                            </td><td>0                 </td><td>0                 </td><td>0                 </td><td>1038     </td><td>374               </td></tr>\n",
       "<tr><td>missing</td><td>0                </td><td>0            </td><td>0                 </td><td>0                   </td><td>419              </td><td>0              </td><td>0                           </td><td>6                     </td><td>0                  </td><td>0                  </td><td>0                 </td><td>162               </td><td>0                 </td><td>0                 </td><td>2557              </td><td>162               </td><td>162               </td><td>0     </td><td>0                     </td><td>162                </td><td>162                </td><td>162                          </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0        </td><td>0                 </td></tr>\n",
       "<tr><td>0      </td><td>9955810.0        </td><td>HY144797     </td><td>1423467820000.0   </td><td>081XX S COLES AVE   </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>422.0             </td><td>4.0               </td><td>7.0               </td><td>46.0              </td><td>18.0              </td><td>1198273.0         </td><td>1851626.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.747693646       </td><td>-87.54903538900001 </td><td>(41.747693646, -87.549035389)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>1      </td><td>9955861.0        </td><td>HY144838     </td><td>1423467702000.0   </td><td>118XX S STATE ST    </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>true               </td><td>true               </td><td>522.0             </td><td>5.0               </td><td>34.0              </td><td>53.0              </td><td>nan               </td><td>1178335.0         </td><td>1826581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.679442289       </td><td>-87.622850758      </td><td>(41.679442289, -87.622850758)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>2      </td><td>9955801.0        </td><td>HY144779     </td><td>1423467022000.0   </td><td>002XX S LARAMIE AVE </td><td>2026.0           </td><td>NARCOTICS      </td><td>POSS: PCP                   </td><td>SIDEWALK              </td><td>true               </td><td>false              </td><td>1522.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>18.0              </td><td>1141717.0         </td><td>1898581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.877773330000004 </td><td>-87.755117993      </td><td>(41.87777333, -87.755117993) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>3      </td><td>9956197.0        </td><td>HY144787     </td><td>1423467023000.0   </td><td>006XX E 67TH ST     </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>321.0             </td><td>nan               </td><td>6.0               </td><td>42.0              </td><td>18.0              </td><td>nan               </td><td>nan               </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>nan                </td><td>nan                </td><td>                             </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>4      </td><td>9955846.0        </td><td>HY144829     </td><td>1423467058000.0   </td><td>0000X S MAYFIELD AVE</td><td>610.0            </td><td>BURGLARY       </td><td>FORCIBLE ENTRY              </td><td>APARTMENT             </td><td>false              </td><td>false              </td><td>1513.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>5.0               </td><td>1137239.0         </td><td>1899372.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.880025548000006 </td><td>-87.77154132400001 </td><td>(41.880025548, -87.771541324)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>5      </td><td>9955835.0        </td><td>HY144778     </td><td>1423467021000.0   </td><td>010XX W 48TH ST     </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>false              </td><td>true               </td><td>933.0             </td><td>9.0               </td><td>3.0               </td><td>61.0              </td><td>nan               </td><td>1169986.0         </td><td>1873019.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.807059405000004 </td><td>-87.65206589       </td><td>(41.807059405, -87.65206589) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>6      </td><td>9955872.0        </td><td>HY144822     </td><td>1423466844000.0   </td><td>015XX W ARTHUR AVE  </td><td>1320.0           </td><td>CRIMINAL DAMAGE</td><td>TO VEHICLE                  </td><td>STREET                </td><td>false              </td><td>false              </td><td>2432.0            </td><td>24.0              </td><td>40.0              </td><td>1.0               </td><td>14.0              </td><td>1164732.0         </td><td>1943222.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.999814056000005 </td><td>-87.669342967      </td><td>(41.999814056, -87.669342967)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>7      </td><td>21752.0          </td><td>HY144738     </td><td>1423466772000.0   </td><td>060XX W GRAND AVE   </td><td>110.0            </td><td>HOMICIDE       </td><td>FIRST DEGREE MURDER         </td><td>STREET                </td><td>true               </td><td>false              </td><td>2512.0            </td><td>25.0              </td><td>37.0              </td><td>19.0              </td><td>nan               </td><td>1135910.0         </td><td>1914206.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.920755683       </td><td>-87.776067514      </td><td>(41.920755683, -87.776067514)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>8      </td><td>9955808.0        </td><td>HY144775     </td><td>1423466433000.0   </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>OTHER                 </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "<tr><td>9      </td><td>9958275.0        </td><td>HY146732     </td><td>1423466136000.0   </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>HOTEL/MOTEL           </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows:9,999 Cols:28\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>1</td>\n",
       "<td>3.5714288</td>\n",
       "<td>     80  B</td>\n",
       "<td>0.0124154</td></tr>\n",
       "<tr><td>CBS</td>\n",
       "<td>Bits</td>\n",
       "<td>2</td>\n",
       "<td>7.1428576</td>\n",
       "<td>    2.6 KB</td>\n",
       "<td>0.4097082</td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>8</td>\n",
       "<td>28.57143</td>\n",
       "<td>   78.6 KB</td>\n",
       "<td>12.498584</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>7</td>\n",
       "<td>25.0</td>\n",
       "<td>   68.8 KB</td>\n",
       "<td>10.936261</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>4</td>\n",
       "<td>14.285715</td>\n",
       "<td>   78.4 KB</td>\n",
       "<td>12.456371</td></tr>\n",
       "<tr><td>C4</td>\n",
       "<td>4-Byte Integers</td>\n",
       "<td>3</td>\n",
       "<td>10.714286</td>\n",
       "<td>  117.4 KB</td>\n",
       "<td>18.652899</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>1</td>\n",
       "<td>3.5714288</td>\n",
       "<td>  127.0 KB</td>\n",
       "<td>20.184338</td></tr>\n",
       "<tr><td>C8D</td>\n",
       "<td>64-bit Reals</td>\n",
       "<td>2</td>\n",
       "<td>7.1428576</td>\n",
       "<td>  156.4 KB</td>\n",
       "<td>24.849424</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size      size_percentage\n",
       "------------  -------------------------  -------  ------------------  --------  -----------------\n",
       "C0L           Constant Integers          1        3.57143             80  B     0.0124154\n",
       "CBS           Bits                       2        7.14286             2.6 KB    0.409708\n",
       "C1            1-Byte Integers            8        28.5714             78.6 KB   12.4986\n",
       "C1N           1-Byte Integers (w/o NAs)  7        25                  68.8 KB   10.9363\n",
       "C2            2-Byte Integers            4        14.2857             78.4 KB   12.4564\n",
       "C4            4-Byte Integers            3        10.7143             117.4 KB  18.6529\n",
       "CStr          String                     1        3.57143             127.0 KB  20.1843\n",
       "C8D           64-bit Reals               2        7.14286             156.4 KB  24.8494"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size      number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  --------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  629.3 KB  9999              1                              28\n",
       "mean               629.3 KB  9999              1                              28\n",
       "min                629.3 KB  9999              1                              28\n",
       "max                629.3 KB  9999              1                              28\n",
       "stddev             0  B      0                 0                              0\n",
       "total              629.3 KB  9999              1                              28"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>ID               </th><th>Case Number  </th><th>Block               </th><th>IUCR             </th><th>Primary Type   </th><th>Description                 </th><th>Location Description  </th><th>Arrest             </th><th>Domestic           </th><th>Beat              </th><th>District          </th><th>Ward              </th><th>Community Area    </th><th>FBI Code          </th><th>X Coordinate      </th><th>Y Coordinate      </th><th>Year  </th><th>Updated On            </th><th>Latitude           </th><th>Longitude          </th><th>Location                     </th><th>Day               </th><th>Month             </th><th>WeekNum           </th><th>WeekDay  </th><th>HourOfDay         </th><th>Weekend            </th><th>Season  </th></tr>\n",
       "<tr><td>type   </td><td>int              </td><td>string       </td><td>enum                </td><td>int              </td><td>enum           </td><td>enum                        </td><td>enum                  </td><td>enum               </td><td>enum               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int   </td><td>enum                  </td><td>real               </td><td>real               </td><td>enum                         </td><td>int               </td><td>int               </td><td>int               </td><td>enum     </td><td>int               </td><td>int                </td><td>enum    </td></tr>\n",
       "<tr><td>mins   </td><td>21735.0          </td><td>NaN          </td><td>0.0                 </td><td>110.0            </td><td>0.0            </td><td>0.0                         </td><td>0.0                   </td><td>0.0                </td><td>0.0                </td><td>111.0             </td><td>1.0               </td><td>1.0               </td><td>1.0               </td><td>2.0               </td><td>1100317.0         </td><td>1814255.0         </td><td>3915.0</td><td>0.0                   </td><td>41.64507243        </td><td>-87.906463888      </td><td>0.0                          </td><td>1.0               </td><td>2.0               </td><td>4.0               </td><td>0.0      </td><td>0.0               </td><td>0.0                </td><td>0.0     </td></tr>\n",
       "<tr><td>mean   </td><td>9931318.737373699</td><td>NaN          </td><td>NaN                 </td><td>1189.676513569939</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.29282928292829274</td><td>0.15231523152315235</td><td>1159.6180618061765</td><td>11.348988512757918</td><td>22.954095409541008</td><td>37.447644764476536</td><td>12.740123622682114</td><td>1163880.5981498407</td><td>1885916.1498424308</td><td>3915.0</td><td>NaN                   </td><td>41.842565224673535 </td><td>-87.67414052209607 </td><td>NaN                          </td><td>17.683968396839663</td><td>2.419441944194423 </td><td>5.1808180818082   </td><td>NaN      </td><td>13.631963196319662</td><td>0.35753575357535755</td><td>NaN     </td></tr>\n",
       "<tr><td>maxs   </td><td>9962898.0        </td><td>NaN          </td><td>6517.0              </td><td>5131.0           </td><td>26.0           </td><td>198.0                       </td><td>90.0                  </td><td>1.0                </td><td>1.0                </td><td>2535.0            </td><td>25.0              </td><td>50.0              </td><td>77.0              </td><td>26.0              </td><td>1205069.0         </td><td>1951533.0         </td><td>3915.0</td><td>32.0                  </td><td>42.022646183       </td><td>-87.524773286      </td><td>8603.0                       </td><td>31.0              </td><td>3.0               </td><td>6.0               </td><td>6.0      </td><td>23.0              </td><td>1.0                </td><td>1.0     </td></tr>\n",
       "<tr><td>sigma  </td><td>396787.5642214295</td><td>NaN          </td><td>NaN                 </td><td>927.7514355826443</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.4550835155878833 </td><td>0.3593441468595258 </td><td>695.7602987498396 </td><td>6.945474933012859 </td><td>13.649566114361296</td><td>21.274876222320856</td><td>7.574238579108433 </td><td>16496.449368147238</td><td>31274.01631985589 </td><td>0.0   </td><td>NaN                   </td><td>0.08601865793584824</td><td>0.06003579706529789</td><td>NaN                          </td><td>11.180104335827702</td><td>0.4934924067865386</td><td>0.7389298304087689</td><td>NaN      </td><td>6.4732173580715475</td><td>0.47929835538994453</td><td>NaN     </td></tr>\n",
       "<tr><td>zeros  </td><td>0                </td><td>0            </td><td>3                   </td><td>0                </td><td>11             </td><td>933                         </td><td>19                    </td><td>7071               </td><td>8476               </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0     </td><td>603                   </td><td>0                  </td><td>0                  </td><td>1                            </td><td>0                 </td><td>0                 </td><td>0                 </td><td>1038     </td><td>374               </td><td>6424               </td><td>5805    </td></tr>\n",
       "<tr><td>missing</td><td>0                </td><td>0            </td><td>0                   </td><td>419              </td><td>0              </td><td>0                           </td><td>6                     </td><td>0                  </td><td>0                  </td><td>0                 </td><td>162               </td><td>0                 </td><td>0                 </td><td>2557              </td><td>162               </td><td>162               </td><td>0     </td><td>0                     </td><td>162                </td><td>162                </td><td>162                          </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0        </td><td>0                 </td><td>0                  </td><td>0       </td></tr>\n",
       "<tr><td>0      </td><td>9955810.0        </td><td>HY144797     </td><td>081XX S COLES AVE   </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>422.0             </td><td>4.0               </td><td>7.0               </td><td>46.0              </td><td>18.0              </td><td>1198273.0         </td><td>1851626.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.747693646       </td><td>-87.54903538900001 </td><td>(41.747693646, -87.549035389)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>1      </td><td>9955861.0        </td><td>HY144838     </td><td>118XX S STATE ST    </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>true               </td><td>true               </td><td>522.0             </td><td>5.0               </td><td>34.0              </td><td>53.0              </td><td>nan               </td><td>1178335.0         </td><td>1826581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.679442289       </td><td>-87.622850758      </td><td>(41.679442289, -87.622850758)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>2      </td><td>9955801.0        </td><td>HY144779     </td><td>002XX S LARAMIE AVE </td><td>2026.0           </td><td>NARCOTICS      </td><td>POSS: PCP                   </td><td>SIDEWALK              </td><td>true               </td><td>false              </td><td>1522.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>18.0              </td><td>1141717.0         </td><td>1898581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.877773330000004 </td><td>-87.755117993      </td><td>(41.87777333, -87.755117993) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>3      </td><td>9956197.0        </td><td>HY144787     </td><td>006XX E 67TH ST     </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>321.0             </td><td>nan               </td><td>6.0               </td><td>42.0              </td><td>18.0              </td><td>nan               </td><td>nan               </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>nan                </td><td>nan                </td><td>                             </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>4      </td><td>9955846.0        </td><td>HY144829     </td><td>0000X S MAYFIELD AVE</td><td>610.0            </td><td>BURGLARY       </td><td>FORCIBLE ENTRY              </td><td>APARTMENT             </td><td>false              </td><td>false              </td><td>1513.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>5.0               </td><td>1137239.0         </td><td>1899372.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.880025548000006 </td><td>-87.77154132400001 </td><td>(41.880025548, -87.771541324)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>5      </td><td>9955835.0        </td><td>HY144778     </td><td>010XX W 48TH ST     </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>false              </td><td>true               </td><td>933.0             </td><td>9.0               </td><td>3.0               </td><td>61.0              </td><td>nan               </td><td>1169986.0         </td><td>1873019.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.807059405000004 </td><td>-87.65206589       </td><td>(41.807059405, -87.65206589) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>6      </td><td>9955872.0        </td><td>HY144822     </td><td>015XX W ARTHUR AVE  </td><td>1320.0           </td><td>CRIMINAL DAMAGE</td><td>TO VEHICLE                  </td><td>STREET                </td><td>false              </td><td>false              </td><td>2432.0            </td><td>24.0              </td><td>40.0              </td><td>1.0               </td><td>14.0              </td><td>1164732.0         </td><td>1943222.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.999814056000005 </td><td>-87.669342967      </td><td>(41.999814056, -87.669342967)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>7      </td><td>21752.0          </td><td>HY144738     </td><td>060XX W GRAND AVE   </td><td>110.0            </td><td>HOMICIDE       </td><td>FIRST DEGREE MURDER         </td><td>STREET                </td><td>true               </td><td>false              </td><td>2512.0            </td><td>25.0              </td><td>37.0              </td><td>19.0              </td><td>nan               </td><td>1135910.0         </td><td>1914206.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.920755683       </td><td>-87.776067514      </td><td>(41.920755683, -87.776067514)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>8      </td><td>9955808.0        </td><td>HY144775     </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>OTHER                 </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>9      </td><td>9958275.0        </td><td>HY146732     </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>HOTEL/MOTEL           </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "def refine_date_col(data, col, pattern):\n",
    "    #data[col]         = data[col].as_date(pattern) # As of 5/29/2106 H2O defaults parse as a date\n",
    "    data[\"Day\"]       = data[col].day()\n",
    "    data[\"Month\"]     = data[col].month() + 1     # Since H2O indexes from 0\n",
    "    data[\"Year\"]      = data[col].year() + 1900   # Start of epoch is 1900\n",
    "    data[\"WeekNum\"]   = data[col].week()\n",
    "    data[\"WeekDay\"]   = data[col].dayOfWeek()\n",
    "    data[\"HourOfDay\"] = data[col].hour()\n",
    "    \n",
    "    data.describe()  # HACK: Force evaluation before ifelse and cut. See https://github.com/h2oai/h2o-3/issues/14398.\n",
    "    \n",
    "    # Create weekend and season cols\n",
    "    # Spring = Mar, Apr, May. Summer = Jun, Jul, Aug. Autumn = Sep, Oct. Winter = Nov, Dec, Jan, Feb.\n",
    "    # data[\"Weekend\"]   = [1 if x in (\"Sun\", \"Sat\") else 0 for x in data[\"WeekDay\"]]\n",
    "    data[\"Weekend\"] = ((data[\"WeekDay\"] == \"Sun\") | (data[\"WeekDay\"] == \"Sat\"))\n",
    "    data[\"Season\"] = data[\"Month\"].cut([0, 2, 5, 7, 10, 12], [\"Winter\", \"Spring\", \"Summer\", \"Autumn\", \"Winter\"])\n",
    "    \n",
    "refine_date_col(crimes, \"Date\", \"%m/%d/%Y %I:%M:%S %p\")\n",
    "crimes = crimes.drop(\"Date\")\n",
    "crimes.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows:9,999 Cols:28\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>1</td>\n",
       "<td>3.5714288</td>\n",
       "<td>     80  B</td>\n",
       "<td>0.0124154</td></tr>\n",
       "<tr><td>CBS</td>\n",
       "<td>Bits</td>\n",
       "<td>2</td>\n",
       "<td>7.1428576</td>\n",
       "<td>    2.6 KB</td>\n",
       "<td>0.4097082</td></tr>\n",
       "<tr><td>C1</td>\n",
       "<td>1-Byte Integers</td>\n",
       "<td>8</td>\n",
       "<td>28.57143</td>\n",
       "<td>   78.6 KB</td>\n",
       "<td>12.498584</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>7</td>\n",
       "<td>25.0</td>\n",
       "<td>   68.8 KB</td>\n",
       "<td>10.936261</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>4</td>\n",
       "<td>14.285715</td>\n",
       "<td>   78.4 KB</td>\n",
       "<td>12.456371</td></tr>\n",
       "<tr><td>C4</td>\n",
       "<td>4-Byte Integers</td>\n",
       "<td>3</td>\n",
       "<td>10.714286</td>\n",
       "<td>  117.4 KB</td>\n",
       "<td>18.652899</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>1</td>\n",
       "<td>3.5714288</td>\n",
       "<td>  127.0 KB</td>\n",
       "<td>20.184338</td></tr>\n",
       "<tr><td>C8D</td>\n",
       "<td>64-bit Reals</td>\n",
       "<td>2</td>\n",
       "<td>7.1428576</td>\n",
       "<td>  156.4 KB</td>\n",
       "<td>24.849424</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size      size_percentage\n",
       "------------  -------------------------  -------  ------------------  --------  -----------------\n",
       "C0L           Constant Integers          1        3.57143             80  B     0.0124154\n",
       "CBS           Bits                       2        7.14286             2.6 KB    0.409708\n",
       "C1            1-Byte Integers            8        28.5714             78.6 KB   12.4986\n",
       "C1N           1-Byte Integers (w/o NAs)  7        25                  68.8 KB   10.9363\n",
       "C2            2-Byte Integers            4        14.2857             78.4 KB   12.4564\n",
       "C4            4-Byte Integers            3        10.7143             117.4 KB  18.6529\n",
       "CStr          String                     1        3.57143             127.0 KB  20.1843\n",
       "C8D           64-bit Reals               2        7.14286             156.4 KB  24.8494"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>  629.3 KB</td>\n",
       "<td>9999.0</td>\n",
       "<td>1.0</td>\n",
       "<td>28.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size      number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  --------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  629.3 KB  9999              1                              28\n",
       "mean               629.3 KB  9999              1                              28\n",
       "min                629.3 KB  9999              1                              28\n",
       "max                629.3 KB  9999              1                              28\n",
       "stddev             0  B      0                 0                              0\n",
       "total              629.3 KB  9999              1                              28"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>ID               </th><th>Case Number  </th><th>Block               </th><th>IUCR             </th><th>Primary Type   </th><th>Description                 </th><th>Location Description  </th><th>Arrest             </th><th>Domestic           </th><th>Beat              </th><th>District          </th><th>Ward              </th><th>Community Area    </th><th>FBI Code          </th><th>X Coordinate      </th><th>Y Coordinate      </th><th>Year  </th><th>Updated On            </th><th>Latitude           </th><th>Longitude          </th><th>Location                     </th><th>Day               </th><th>Month             </th><th>WeekNum           </th><th>WeekDay  </th><th>HourOfDay         </th><th>Weekend            </th><th>Season  </th></tr>\n",
       "<tr><td>type   </td><td>int              </td><td>string       </td><td>enum                </td><td>int              </td><td>enum           </td><td>enum                        </td><td>enum                  </td><td>enum               </td><td>enum               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int               </td><td>int   </td><td>enum                  </td><td>real               </td><td>real               </td><td>enum                         </td><td>int               </td><td>int               </td><td>int               </td><td>enum     </td><td>int               </td><td>int                </td><td>enum    </td></tr>\n",
       "<tr><td>mins   </td><td>21735.0          </td><td>NaN          </td><td>0.0                 </td><td>110.0            </td><td>0.0            </td><td>0.0                         </td><td>0.0                   </td><td>0.0                </td><td>0.0                </td><td>111.0             </td><td>1.0               </td><td>1.0               </td><td>1.0               </td><td>2.0               </td><td>1100317.0         </td><td>1814255.0         </td><td>3915.0</td><td>0.0                   </td><td>41.64507243        </td><td>-87.906463888      </td><td>0.0                          </td><td>1.0               </td><td>2.0               </td><td>4.0               </td><td>0.0      </td><td>0.0               </td><td>0.0                </td><td>0.0     </td></tr>\n",
       "<tr><td>mean   </td><td>9931318.737373699</td><td>NaN          </td><td>NaN                 </td><td>1189.676513569939</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.29282928292829274</td><td>0.15231523152315235</td><td>1159.6180618061765</td><td>11.348988512757918</td><td>22.954095409541008</td><td>37.447644764476536</td><td>12.740123622682114</td><td>1163880.5981498407</td><td>1885916.1498424308</td><td>3915.0</td><td>NaN                   </td><td>41.842565224673535 </td><td>-87.67414052209607 </td><td>NaN                          </td><td>17.683968396839663</td><td>2.419441944194423 </td><td>5.1808180818082   </td><td>NaN      </td><td>13.631963196319662</td><td>0.35753575357535755</td><td>NaN     </td></tr>\n",
       "<tr><td>maxs   </td><td>9962898.0        </td><td>NaN          </td><td>6517.0              </td><td>5131.0           </td><td>26.0           </td><td>198.0                       </td><td>90.0                  </td><td>1.0                </td><td>1.0                </td><td>2535.0            </td><td>25.0              </td><td>50.0              </td><td>77.0              </td><td>26.0              </td><td>1205069.0         </td><td>1951533.0         </td><td>3915.0</td><td>32.0                  </td><td>42.022646183       </td><td>-87.524773286      </td><td>8603.0                       </td><td>31.0              </td><td>3.0               </td><td>6.0               </td><td>6.0      </td><td>23.0              </td><td>1.0                </td><td>1.0     </td></tr>\n",
       "<tr><td>sigma  </td><td>396787.5642214295</td><td>NaN          </td><td>NaN                 </td><td>927.7514355826443</td><td>NaN            </td><td>NaN                         </td><td>NaN                   </td><td>0.4550835155878833 </td><td>0.3593441468595258 </td><td>695.7602987498396 </td><td>6.945474933012859 </td><td>13.649566114361296</td><td>21.274876222320856</td><td>7.574238579108433 </td><td>16496.449368147238</td><td>31274.01631985589 </td><td>0.0   </td><td>NaN                   </td><td>0.08601865793584824</td><td>0.06003579706529789</td><td>NaN                          </td><td>11.180104335827702</td><td>0.4934924067865386</td><td>0.7389298304087689</td><td>NaN      </td><td>6.4732173580715475</td><td>0.47929835538994453</td><td>NaN     </td></tr>\n",
       "<tr><td>zeros  </td><td>0                </td><td>0            </td><td>3                   </td><td>0                </td><td>11             </td><td>933                         </td><td>19                    </td><td>7071               </td><td>8476               </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0     </td><td>603                   </td><td>0                  </td><td>0                  </td><td>1                            </td><td>0                 </td><td>0                 </td><td>0                 </td><td>1038     </td><td>374               </td><td>6424               </td><td>5805    </td></tr>\n",
       "<tr><td>missing</td><td>0                </td><td>0            </td><td>0                   </td><td>419              </td><td>0              </td><td>0                           </td><td>6                     </td><td>0                  </td><td>0                  </td><td>0                 </td><td>162               </td><td>0                 </td><td>0                 </td><td>2557              </td><td>162               </td><td>162               </td><td>0     </td><td>0                     </td><td>162                </td><td>162                </td><td>162                          </td><td>0                 </td><td>0                 </td><td>0                 </td><td>0        </td><td>0                 </td><td>0                  </td><td>0       </td></tr>\n",
       "<tr><td>0      </td><td>9955810.0        </td><td>HY144797     </td><td>081XX S COLES AVE   </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>422.0             </td><td>4.0               </td><td>7.0               </td><td>46.0              </td><td>18.0              </td><td>1198273.0         </td><td>1851626.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.747693646       </td><td>-87.54903538900001 </td><td>(41.747693646, -87.549035389)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>1      </td><td>9955861.0        </td><td>HY144838     </td><td>118XX S STATE ST    </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>true               </td><td>true               </td><td>522.0             </td><td>5.0               </td><td>34.0              </td><td>53.0              </td><td>nan               </td><td>1178335.0         </td><td>1826581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.679442289       </td><td>-87.622850758      </td><td>(41.679442289, -87.622850758)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>2      </td><td>9955801.0        </td><td>HY144779     </td><td>002XX S LARAMIE AVE </td><td>2026.0           </td><td>NARCOTICS      </td><td>POSS: PCP                   </td><td>SIDEWALK              </td><td>true               </td><td>false              </td><td>1522.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>18.0              </td><td>1141717.0         </td><td>1898581.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.877773330000004 </td><td>-87.755117993      </td><td>(41.87777333, -87.755117993) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>3      </td><td>9956197.0        </td><td>HY144787     </td><td>006XX E 67TH ST     </td><td>1811.0           </td><td>NARCOTICS      </td><td>POSS: CANNABIS 30GMS OR LESS</td><td>STREET                </td><td>true               </td><td>false              </td><td>321.0             </td><td>nan               </td><td>6.0               </td><td>42.0              </td><td>18.0              </td><td>nan               </td><td>nan               </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>nan                </td><td>nan                </td><td>                             </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>4      </td><td>9955846.0        </td><td>HY144829     </td><td>0000X S MAYFIELD AVE</td><td>610.0            </td><td>BURGLARY       </td><td>FORCIBLE ENTRY              </td><td>APARTMENT             </td><td>false              </td><td>false              </td><td>1513.0            </td><td>15.0              </td><td>29.0              </td><td>25.0              </td><td>5.0               </td><td>1137239.0         </td><td>1899372.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.880025548000006 </td><td>-87.77154132400001 </td><td>(41.880025548, -87.771541324)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>5      </td><td>9955835.0        </td><td>HY144778     </td><td>010XX W 48TH ST     </td><td>486.0            </td><td>BATTERY        </td><td>DOMESTIC BATTERY SIMPLE     </td><td>APARTMENT             </td><td>false              </td><td>true               </td><td>933.0             </td><td>9.0               </td><td>3.0               </td><td>61.0              </td><td>nan               </td><td>1169986.0         </td><td>1873019.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.807059405000004 </td><td>-87.65206589       </td><td>(41.807059405, -87.65206589) </td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>6      </td><td>9955872.0        </td><td>HY144822     </td><td>015XX W ARTHUR AVE  </td><td>1320.0           </td><td>CRIMINAL DAMAGE</td><td>TO VEHICLE                  </td><td>STREET                </td><td>false              </td><td>false              </td><td>2432.0            </td><td>24.0              </td><td>40.0              </td><td>1.0               </td><td>14.0              </td><td>1164732.0         </td><td>1943222.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.999814056000005 </td><td>-87.669342967      </td><td>(41.999814056, -87.669342967)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>7      </td><td>21752.0          </td><td>HY144738     </td><td>060XX W GRAND AVE   </td><td>110.0            </td><td>HOMICIDE       </td><td>FIRST DEGREE MURDER         </td><td>STREET                </td><td>true               </td><td>false              </td><td>2512.0            </td><td>25.0              </td><td>37.0              </td><td>19.0              </td><td>nan               </td><td>1135910.0         </td><td>1914206.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.920755683       </td><td>-87.776067514      </td><td>(41.920755683, -87.776067514)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>8      </td><td>9955808.0        </td><td>HY144775     </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>OTHER                 </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "<tr><td>9      </td><td>9958275.0        </td><td>HY146732     </td><td>001XX W WACKER DR   </td><td>460.0            </td><td>BATTERY        </td><td>SIMPLE                      </td><td>HOTEL/MOTEL           </td><td>false              </td><td>false              </td><td>122.0             </td><td>1.0               </td><td>42.0              </td><td>32.0              </td><td>nan               </td><td>1175384.0         </td><td>1902088.0         </td><td>3915.0</td><td>02/15/2015 12:43:39 PM</td><td>41.886707818000005 </td><td>-87.63139635600001 </td><td>(41.886707818, -87.631396356)</td><td>8.0               </td><td>3.0               </td><td>6.0               </td><td>Sun      </td><td>23.0              </td><td>1.0                </td><td>Spring  </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Merge crimes data with weather and census\n",
    "census.set_name(0,\"Community Area\")\n",
    "weather.set_name(1,\"Month\")\n",
    "weather.set_name(2,\"Day\")\n",
    "weather.set_name(3,\"Year\")\n",
    "crimes.merge(census, all_x=True, all_y=False)\n",
    "crimes.merge(weather, all_x=True, all_y=False)\n",
    "crimes.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "gbm Model Build Progress: [##################################################] 100%\n",
      "\n",
      "deeplearning Model Build Progress: [##################################################] 100%\n"
     ]
    }
   ],
   "source": [
    "# Create test/train split\n",
    "r = crimes[\"Arrest\"].runif(1234)\n",
    "train = crimes[r < 0.8]\n",
    "test = crimes[r >= 0.8]\n",
    "\n",
    "# Simple GBM - Predict Arrest\n",
    "crimes_names_x = crimes.names[:]\n",
    "crimes_names_x.remove(\"Arrest\")\n",
    "data_gbm = H2OGradientBoostingEstimator(ntrees         =10,\n",
    "                                        max_depth      =6,\n",
    "                                        distribution   =\"bernoulli\")\n",
    "\n",
    "data_gbm.train(x               =crimes_names_x,\n",
    "               y               =\"Arrest\",\n",
    "               training_frame  =train,\n",
    "               validation_frame=test)\n",
    "\n",
    "# Simple Deep Learning - Predict Arrest\n",
    "# data_dl = H2ODeepLearningEstimator(variable_importances=True,\n",
    "#                                    loss                =\"Automatic\")\n",
    "\n",
    "# data_dl.train(x                =crimes_names_x,\n",
    "#               y                =\"Arrest\",\n",
    "#               training_frame  =train,\n",
    "#               validation_frame=test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>Model</b></td>\n",
       "<td><b>AUC Train</b></td>\n",
       "<td><b>AUC Test</b></td></tr>\n",
       "<tr><td>GBM</td>\n",
       "<td>0.9568221</td>\n",
       "<td>0.9307979</td></tr>\n",
       "<tr><td>DL </td>\n",
       "<td>0.8956055</td>\n",
       "<td>0.8841564</td></tr></table></div>"
      ],
      "text/plain": [
       "Model      AUC Train    AUC Test\n",
       "-------  -----------  ----------\n",
       "GBM         0.956822    0.930798\n",
       "DL          0.895605    0.884156"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>Model</b></td>\n",
       "<td><b>AUC Train</b></td>\n",
       "<td><b>AUC Test</b></td></tr>\n",
       "<tr><td>GBM</td>\n",
       "<td>0.9568221</td>\n",
       "<td>0.9307979</td></tr>\n",
       "<tr><td>DL </td>\n",
       "<td>0.8956055</td>\n",
       "<td>0.8841564</td></tr></table></div>"
      ],
      "text/plain": []
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# GBM performance on train/test data\n",
    "train_auc_gbm = data_gbm.model_performance(train).auc()\n",
    "test_auc_gbm  = data_gbm.model_performance(test) .auc()\n",
    "\n",
    "# Deep Learning performance on train/test data\n",
    "# train_auc_dl = data_dl.model_performance(train).auc()\n",
    "# test_auc_dl  = data_dl.model_performance(test) .auc()\n",
    "\n",
    "# Make a pretty HTML table printout of the results\n",
    "header = [\"Model\", \"AUC Train\", \"AUC Test\"]\n",
    "table  = [\n",
    "           [\"GBM\", train_auc_gbm, test_auc_gbm],\n",
    "#            [\"DL \", train_auc_dl, test_auc_dl]\n",
    "         ]\n",
    "h2o.display.H2OTableDisplay(table, columns_labels=header)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Parse Progress: [##################################################] 100%\n",
      "Rows:2 Cols:16\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>7</td>\n",
       "<td>43.75</td>\n",
       "<td>    560  B</td>\n",
       "<td>43.75</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>4</td>\n",
       "<td>25.0</td>\n",
       "<td>    280  B</td>\n",
       "<td>21.875</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>2</td>\n",
       "<td>12.5</td>\n",
       "<td>    144  B</td>\n",
       "<td>11.25</td></tr>\n",
       "<tr><td>C2S</td>\n",
       "<td>2-Byte Fractions</td>\n",
       "<td>1</td>\n",
       "<td>6.25</td>\n",
       "<td>     88  B</td>\n",
       "<td>6.875</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>2</td>\n",
       "<td>12.5</td>\n",
       "<td>    208  B</td>\n",
       "<td>16.25</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size    size_percentage\n",
       "------------  -------------------------  -------  ------------------  ------  -----------------\n",
       "C0L           Constant Integers          7        43.75               560  B  43.75\n",
       "C1N           1-Byte Integers (w/o NAs)  4        25                  280  B  21.875\n",
       "C2            2-Byte Integers            2        12.5                144  B  11.25\n",
       "C2S           2-Byte Fractions           1        6.25                88  B   6.875\n",
       "CStr          String                     2        12.5                208  B  16.25"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>    1.3 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>16.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>    1.3 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>16.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>    1.3 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>16.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>    1.3 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>16.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>    1.3 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>16.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size    number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  ------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  1.3 KB  2                 1                              16\n",
       "mean               1.3 KB  2                 1                              16\n",
       "min                1.3 KB  2                 1                              16\n",
       "max                1.3 KB  2                 1                              16\n",
       "stddev             0  B    0                 0                              0\n",
       "total              1.3 KB  2                 1                              16"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>Primary.Type      </th><th>Domestic  </th><th>FBI.Code         </th><th>Ward             </th><th>District          </th><th>Community.Area    </th><th>Location.Description  </th><th>Date             </th><th>IUCR              </th><th>Beat              </th><th>Day  </th><th>Month  </th><th>Year  </th><th>WeekNum  </th><th>WeekDay  </th><th>HourOfDay  </th></tr>\n",
       "<tr><td>type   </td><td>string            </td><td>enum      </td><td>int              </td><td>int              </td><td>int               </td><td>int               </td><td>string                </td><td>int              </td><td>int               </td><td>int               </td><td>int  </td><td>int    </td><td>int   </td><td>int      </td><td>enum     </td><td>int        </td></tr>\n",
       "<tr><td>mins   </td><td>NaN               </td><td>0.0       </td><td>11.0             </td><td>7.0              </td><td>4.0               </td><td>46.0              </td><td>NaN                   </td><td>1423465239000.0  </td><td>1150.0            </td><td>422.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>6.0      </td><td>23.0       </td></tr>\n",
       "<tr><td>mean   </td><td>NaN               </td><td>0.0       </td><td>14.5             </td><td>10.5             </td><td>6.5               </td><td>54.5              </td><td>NaN                   </td><td>1423466538500.0  </td><td>1480.5            </td><td>672.5             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>NaN      </td><td>23.0       </td></tr>\n",
       "<tr><td>maxs   </td><td>NaN               </td><td>0.0       </td><td>18.0             </td><td>14.0             </td><td>9.0               </td><td>63.0              </td><td>NaN                   </td><td>1423467838000.0  </td><td>1811.0            </td><td>923.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>6.0      </td><td>23.0       </td></tr>\n",
       "<tr><td>sigma  </td><td>NaN               </td><td>0.0       </td><td>4.949747468305833</td><td>4.949747468305833</td><td>3.5355339059327378</td><td>12.020815280171307</td><td>NaN                   </td><td>1837770.524303837</td><td>467.39758236430794</td><td>354.26049737446033</td><td>0.0  </td><td>0.0    </td><td>0.0   </td><td>0.0      </td><td>NaN      </td><td>0.0        </td></tr>\n",
       "<tr><td>zeros  </td><td>0                 </td><td>2         </td><td>0                </td><td>0                </td><td>0                 </td><td>0                 </td><td>0                     </td><td>0                </td><td>0                 </td><td>0                 </td><td>0    </td><td>0      </td><td>0     </td><td>0        </td><td>0        </td><td>0          </td></tr>\n",
       "<tr><td>missing</td><td>0                 </td><td>0         </td><td>0                </td><td>0                </td><td>0                 </td><td>0                 </td><td>0                     </td><td>0                </td><td>0                 </td><td>0                 </td><td>0    </td><td>0      </td><td>0     </td><td>0        </td><td>0        </td><td>0          </td></tr>\n",
       "<tr><td>0      </td><td>NARCOTICS         </td><td>false     </td><td>18.0             </td><td>7.0              </td><td>4.0               </td><td>46.0              </td><td>STREET                </td><td>1423467838000.0  </td><td>1811.0            </td><td>422.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>Sun      </td><td>23.0       </td></tr>\n",
       "<tr><td>1      </td><td>DECEPTIVE PRACTICE</td><td>false     </td><td>11.0             </td><td>14.0             </td><td>9.0               </td><td>63.0              </td><td>RESIDENCE             </td><td>1423465239000.0  </td><td>1150.0            </td><td>923.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>Sun      </td><td>23.0       </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rows:2 Cols:18\n",
      "\n",
      "Chunk compression summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>chunk_type</b></td>\n",
       "<td><b>chunk_name</b></td>\n",
       "<td><b>count</b></td>\n",
       "<td><b>count_percentage</b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>size_percentage</b></td></tr>\n",
       "<tr><td>C0L</td>\n",
       "<td>Constant Integers</td>\n",
       "<td>9</td>\n",
       "<td>50.0</td>\n",
       "<td>    720  B</td>\n",
       "<td>50.0</td></tr>\n",
       "<tr><td>C1N</td>\n",
       "<td>1-Byte Integers (w/o NAs)</td>\n",
       "<td>4</td>\n",
       "<td>22.222223</td>\n",
       "<td>    280  B</td>\n",
       "<td>19.444445</td></tr>\n",
       "<tr><td>C2</td>\n",
       "<td>2-Byte Integers</td>\n",
       "<td>2</td>\n",
       "<td>11.111112</td>\n",
       "<td>    144  B</td>\n",
       "<td>10.0</td></tr>\n",
       "<tr><td>C2S</td>\n",
       "<td>2-Byte Fractions</td>\n",
       "<td>1</td>\n",
       "<td>5.555556</td>\n",
       "<td>     88  B</td>\n",
       "<td>6.111111</td></tr>\n",
       "<tr><td>CStr</td>\n",
       "<td>String</td>\n",
       "<td>2</td>\n",
       "<td>11.111112</td>\n",
       "<td>    208  B</td>\n",
       "<td>14.444445</td></tr></table></div>"
      ],
      "text/plain": [
       "chunk_type    chunk_name                 count    count_percentage    size    size_percentage\n",
       "------------  -------------------------  -------  ------------------  ------  -----------------\n",
       "C0L           Constant Integers          9        50                  720  B  50\n",
       "C1N           1-Byte Integers (w/o NAs)  4        22.2222             280  B  19.4444\n",
       "C2            2-Byte Integers            2        11.1111             144  B  10\n",
       "C2S           2-Byte Fractions           1        5.55556             88  B   6.11111\n",
       "CStr          String                     2        11.1111             208  B  14.4444"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Frame distribution summary: \n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b></b></td>\n",
       "<td><b>size</b></td>\n",
       "<td><b>number_of_rows</b></td>\n",
       "<td><b>number_of_chunks_per_column</b></td>\n",
       "<td><b>number_of_chunks</b></td></tr>\n",
       "<tr><td>172.16.2.43:54321</td>\n",
       "<td>    1.4 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>18.0</td></tr>\n",
       "<tr><td>mean</td>\n",
       "<td>    1.4 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>18.0</td></tr>\n",
       "<tr><td>min</td>\n",
       "<td>    1.4 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>18.0</td></tr>\n",
       "<tr><td>max</td>\n",
       "<td>    1.4 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>18.0</td></tr>\n",
       "<tr><td>stddev</td>\n",
       "<td>      0  B</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td>\n",
       "<td>0.0</td></tr>\n",
       "<tr><td>total</td>\n",
       "<td>    1.4 KB</td>\n",
       "<td>2.0</td>\n",
       "<td>1.0</td>\n",
       "<td>18.0</td></tr></table></div>"
      ],
      "text/plain": [
       "                   size    number_of_rows    number_of_chunks_per_column    number_of_chunks\n",
       "-----------------  ------  ----------------  -----------------------------  ------------------\n",
       "172.16.2.43:54321  1.4 KB  2                 1                              18\n",
       "mean               1.4 KB  2                 1                              18\n",
       "min                1.4 KB  2                 1                              18\n",
       "max                1.4 KB  2                 1                              18\n",
       "stddev             0  B    0                 0                              0\n",
       "total              1.4 KB  2                 1                              18"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<tr><th>       </th><th>Primary.Type      </th><th>Domestic  </th><th>FBI.Code         </th><th>Ward             </th><th>District          </th><th>Community.Area    </th><th>Location.Description  </th><th>Date             </th><th>IUCR              </th><th>Beat              </th><th>Day  </th><th>Month  </th><th>Year  </th><th>WeekNum  </th><th>WeekDay  </th><th>HourOfDay  </th><th>Weekend  </th><th>Season  </th></tr>\n",
       "<tr><td>type   </td><td>string            </td><td>enum      </td><td>int              </td><td>int              </td><td>int               </td><td>int               </td><td>string                </td><td>int              </td><td>int               </td><td>int               </td><td>int  </td><td>int    </td><td>int   </td><td>int      </td><td>enum     </td><td>int        </td><td>int      </td><td>enum    </td></tr>\n",
       "<tr><td>mins   </td><td>NaN               </td><td>0.0       </td><td>11.0             </td><td>7.0              </td><td>4.0               </td><td>46.0              </td><td>NaN                   </td><td>1423465239000.0  </td><td>1150.0            </td><td>422.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>6.0      </td><td>23.0       </td><td>1.0      </td><td>1.0     </td></tr>\n",
       "<tr><td>mean   </td><td>NaN               </td><td>0.0       </td><td>14.5             </td><td>10.5             </td><td>6.5               </td><td>54.5              </td><td>NaN                   </td><td>1423466538500.0  </td><td>1480.5            </td><td>672.5             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>NaN      </td><td>23.0       </td><td>1.0      </td><td>NaN     </td></tr>\n",
       "<tr><td>maxs   </td><td>NaN               </td><td>0.0       </td><td>18.0             </td><td>14.0             </td><td>9.0               </td><td>63.0              </td><td>NaN                   </td><td>1423467838000.0  </td><td>1811.0            </td><td>923.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>6.0      </td><td>23.0       </td><td>1.0      </td><td>1.0     </td></tr>\n",
       "<tr><td>sigma  </td><td>NaN               </td><td>0.0       </td><td>4.949747468305833</td><td>4.949747468305833</td><td>3.5355339059327378</td><td>12.020815280171307</td><td>NaN                   </td><td>1837770.524303837</td><td>467.39758236430794</td><td>354.26049737446033</td><td>0.0  </td><td>0.0    </td><td>0.0   </td><td>0.0      </td><td>NaN      </td><td>0.0        </td><td>0.0      </td><td>NaN     </td></tr>\n",
       "<tr><td>zeros  </td><td>0                 </td><td>2         </td><td>0                </td><td>0                </td><td>0                 </td><td>0                 </td><td>0                     </td><td>0                </td><td>0                 </td><td>0                 </td><td>0    </td><td>0      </td><td>0     </td><td>0        </td><td>0        </td><td>0          </td><td>0        </td><td>0       </td></tr>\n",
       "<tr><td>missing</td><td>0                 </td><td>0         </td><td>0                </td><td>0                </td><td>0                 </td><td>0                 </td><td>0                     </td><td>0                </td><td>0                 </td><td>0                 </td><td>0    </td><td>0      </td><td>0     </td><td>0        </td><td>0        </td><td>0          </td><td>0        </td><td>0       </td></tr>\n",
       "<tr><td>0      </td><td>NARCOTICS         </td><td>false     </td><td>18.0             </td><td>7.0              </td><td>4.0               </td><td>46.0              </td><td>STREET                </td><td>1423467838000.0  </td><td>1811.0            </td><td>422.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>Sun      </td><td>23.0       </td><td>1.0      </td><td>Spring  </td></tr>\n",
       "<tr><td>1      </td><td>DECEPTIVE PRACTICE</td><td>false     </td><td>11.0             </td><td>14.0             </td><td>9.0               </td><td>63.0              </td><td>RESIDENCE             </td><td>1423465239000.0  </td><td>1150.0            </td><td>923.0             </td><td>8.0  </td><td>3.0    </td><td>3915.0</td><td>6.0      </td><td>Sun      </td><td>23.0       </td><td>1.0      </td><td>Spring  </td></tr>\n",
       "</table>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Create new H2OFrame of crime observations\n",
    "examples = {\n",
    "            \"Date\":                 [\"02/08/2015 11:43:58 PM\", \"02/08/2015 11:00:39 PM\"],\n",
    "            \"IUCR\":                 [1811, 1150],\n",
    "            \"Primary.Type\":         [\"NARCOTICS\", \"DECEPTIVE PRACTICE\"],\n",
    "            \"Location.Description\": [\"STREET\", \"RESIDENCE\"],\n",
    "            \"Domestic\":             [\"false\", \"false\"],\n",
    "            \"Beat\":                 [422, 923],\n",
    "            \"District\":             [4, 9],\n",
    "            \"Ward\":                 [7, 14],\n",
    "            \"Community.Area\":       [46, 63],\n",
    "            \"FBI.Code\":             [18, 11]\n",
    "            }\n",
    "\n",
    "crime_examples = h2o.H2OFrame(examples)\n",
    "\n",
    "# Refine date column and merge with census data\n",
    "refine_date_col(crime_examples, \"Date\", \"%m/%d/%Y %I:%M:%S %p\")\n",
    "crime_examples.drop(\"Date\")\n",
    "census.set_name(0,\"Community.Area\")\n",
    "crime_examples.merge(census, all_x=True, all_y=False)\n",
    "crime_examples.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>FBI Code</b></td>\n",
       "<td><b>GBM Arrest Prob</b></td>\n",
       "<td><b>DL Arrest Prob</b></td></tr>\n",
       "<tr><td>18</td>\n",
       "<td>0.1199714</td>\n",
       "<td>0.3047381</td></tr>\n",
       "<tr><td>11</td>\n",
       "<td>0.1199714</td>\n",
       "<td>0.2496035</td></tr></table></div>"
      ],
      "text/plain": [
       "  FBI Code    GBM Arrest Prob    DL Arrest Prob\n",
       "----------  -----------------  ----------------\n",
       "        18           0.119971          0.304738\n",
       "        11           0.119971          0.249603"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div style=\"overflow:auto\"><table style=\"width:50%\"><tr><td><b>FBI Code</b></td>\n",
       "<td><b>GBM Arrest Prob</b></td>\n",
       "<td><b>DL Arrest Prob</b></td></tr>\n",
       "<tr><td>18</td>\n",
       "<td>0.1199714</td>\n",
       "<td>0.3047381</td></tr>\n",
       "<tr><td>11</td>\n",
       "<td>0.1199714</td>\n",
       "<td>0.2496035</td></tr></table></div>"
      ],
      "text/plain": []
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Predict probability of arrest from new observations\n",
    "gbm_pred = data_gbm.predict(crime_examples)\n",
    "# dl_pred  = data_dl .predict(crime_examples)\n",
    "\n",
    "# Make a pretty HTML table printout of the results\n",
    "# header = [\"FBI Code\", \"GBM Arrest Prob\", \"DL Arrest Prob\"]\n",
    "# table  = [\n",
    "#            [examples[\"FBI.Code\"][0], gbm_pred[0,\"true\"], dl_pred[0,\"true\"]],\n",
    "#            [examples[\"FBI.Code\"][1], gbm_pred[1,\"true\"], dl_pred[1,\"true\"]]\n",
    "#          ]\n",
    "header = [\"FBI Code\", \"GBM Arrest Prob\"]\n",
    "table  = [\n",
    "           [examples[\"FBI.Code\"][0], gbm_pred[0,\"true\"]],\n",
    "           [examples[\"FBI.Code\"][1], gbm_pred[1,\"true\"]],\n",
    "         ]\n",
    "h2o.display.H2OTableDisplay(table, columns_labels=header)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
